<%@ Page Language="VB" AutoEventWireup="false" CodeFile="frmCargarFoto.aspx.vb" Inherits="Pages_frmCargarFoto" title="Socio - Subir Foto" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxUploadControl" TagPrefix="dxuc" %>
 <%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Cargar Foto</title>
</head>

<script type="text/javascript"><!--
 var aspxPreviewImgSrc = getPreviewImageElement().src;
 
function Uploader_OnUploadStart() {
    btnUpload.SetText("Subiendo...");
    btnUpload.SetEnabled(false);
}
function Uploader_OnUploadComplete(args) {
    var imgSrc = aspxPreviewImgSrc;
    if (args.isValid) {
        var date = new Date();
        imgSrc = "../UploadImages/" + args.callbackData + "?dx=" + date.getTime();
    }
    getPreviewImageElement().src = imgSrc;
 
    btnUpload.SetEnabled(true);
    btnUpload.SetText("Subir");
}
function getPreviewImageElement() {
    return _aspxGetElementById("previewImage");
}


//--></script>

<body>
    <form id="form1" runat="server">
        <a href="~/Bin/AjaxControlToolkit.dll"></a>
        <div>
        &nbsp;&nbsp;
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <table style="width: 75%">
                <tr>
                    <td>
                    </td>
                    <td style="width: 105px">
                    </td>
                    <td colspan="2">
                        <dxe:ASPxTextBox ID="txtTitularID" runat="server" Width="170px" Visible="False">
                        </dxe:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td style="width: 105px">
                    </td>
                    <td colspan="2">
                        <asp:TextBox ID="txtFoto" runat="server" Width="433px" Visible="False"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td style="width: 105px">
                        <dxe:ASPxLabel ID="lblTitular" runat="server" Font-Bold="True" Text="Titular :" Width="79px">
                        </dxe:ASPxLabel>
                    </td>
                    <td colspan="2">
                        <dxe:ASPxLabel ID="lblNombreTitular" runat="server" Width="266px">
                        </dxe:ASPxLabel>
                    </td>
                </tr>
                <tr>
                    <td style="height: 156px">
                    </td>
                    <td style="width: 105px; height: 156px">
                        &nbsp;</td>
                    <td style="height: 156px" colspan="2">
                        <img src="../UploadImages/ImagePreview.jpg" id="previewImage" alt="" style="width: 217px" /></td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td style="width: 105px">
                    </td>
                    <td colspan="2">
                        <dxuc:ASPxUploadControl ID="uplImage" runat="server" ClientInstanceName="uploader"
                            Size="35" OnFileUploadComplete="uplImage_FileUploadComplete">
                            <ClientSideEvents FileUploadComplete="function(s, e) { Uploader_OnUploadComplete(e); }"
                                FileUploadStart="function(s, e) { Uploader_OnUploadStart(); }"></ClientSideEvents>
                            <ValidationSettings MaxFileSize="4000000" AllowedContentTypes="image/jpeg,image/gif,image/pjpeg">
                            </ValidationSettings>
                        </dxuc:ASPxUploadControl>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td style="width: 105px">
                    </td>
                    <td colspan="2">
                        <dxe:ASPxLabel ID="lblMensaje" runat="server" CssFilePath="~/App_Themes/Youthful/{0}/styles.css"
                            CssPostfix="Youthful" ForeColor="#FF0000" Width="409px">
                        </dxe:ASPxLabel>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td style="width: 105px">
                        <dxe:ASPxButton ID="btnUpload" runat="server" AutoPostBack="False" Text="Subir"
                            ClientInstanceName="btnUpload" Width="100px" CssFilePath="~/App_Themes/Youthful/{0}/styles.css" CssPostfix="Youthful" SpriteCssFilePath="~/App_Themes/Youthful/{0}/sprite.css" Font-Bold="True">
                            <ClientSideEvents Click="function(s, e) { uploader.UploadFile(); }" />
                        </dxe:ASPxButton>
                    </td>
                    <td style="width: 23px">
                        <dxe:ASPxButton ID="btnCancelar" runat="server" CssFilePath="~/App_Themes/Youthful/{0}/styles.css"
                            CssPostfix="Youthful" Font-Bold="True" SpriteCssFilePath="~/App_Themes/Youthful/{0}/sprite.css"
                            Text="Cancelar">
                        </dxe:ASPxButton>
                    </td>
                    <td>
                        <dxe:ASPxButton ID="btnGrabar" runat="server" CssFilePath="~/App_Themes/Youthful/{0}/styles.css"
                            CssPostfix="Youthful" Font-Bold="True" SpriteCssFilePath="~/App_Themes/Youthful/{0}/sprite.css"
                            Text="Grabar">
                        </dxe:ASPxButton>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</body>
<%--<script type="text/javascript"><!--
    var aspxPreviewImgSrc = getPreviewImageElement().src;
//--></script>--%>
</html>
